import { defineConfig } from 'vite';
import {envConfig} from "./env.js";

export default defineConfig({
    server: {
        proxy: {
            // 保持与生产环境Nginx路径一致[2](@ref)
            '/user': {  // 对应VITE_API_A_URL路径
                target: envConfig.API_A_URL,
                changeOrigin: true,
                rewrite: path => path.replace(/^\/user/, '')
            },
            '/dc': {    // 对应VITE_API_B_URL路径
                target: 'http://localhost:8081',
                changeOrigin: true,
                rewrite: path => path.replace(/^\/dc/, '')
            },
            '/payment': { // 对应VITE_API_C_URL路径
                target: 'http://localhost:8083',
                changeOrigin: true
            }
        }
    },
    // 移除define配置（Vite已自动注入环境变量）[7](@ref)

    optimizeDeps: {
        include: ['mammoth']
    }
});


